home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre4.z / postgre4 / src / utils / fmgr / smalloc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  519 b   |  26 lines

  1. /* ----------------------------------------------------------------
  2.  *    smalloc.c
  3.  *
  4.  *    $Header: /private/postgres/src/utils/fmgr/RCS/smalloc.c,v 1.4 1990/02/12 19:50:38 cimarron Exp $
  5.  * ----------------------------------------------------------------
  6.  */
  7. static char error[] = "Out of memory\n";
  8.  
  9. int*
  10. smalloc(size) /* "Safe" alloc */
  11. {  int* retval = (int*)calloc(1,size);
  12.  
  13.    if (retval == 0)
  14.     { write(2, error, sizeof(error));
  15.       exitpg(-1);
  16.     }
  17.    else return retval;
  18. }
  19.  
  20.  
  21.  
  22. sfree(ptr)
  23. {
  24.   if (ptr != 0) free(ptr);
  25. }
  26.